/* Createdesign.css */
/* ========== 基础重置 ========== */
html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 
               'Helvetica Neue', Arial, sans-serif;
  color: #333;
}

/* ========== 主容器布局 ========== */
.main-container {
  display: flex;
  width: 100vw;
  height: 100vh;
  box-sizing: border-box;
  background-color: #f5f5f5;
}

/* ========== 左侧边栏样式 ========== */
.left-sidebar {
  width: 60px;
  flex-shrink: 0;
  background-color: #2c3e50;
  display: flex;
  flex-direction: column;
  padding: 10px 5px;
  z-index: 3;
  border-right: 1px solid #1a252f;
  overflow-y: auto;
  height: 100vh;
}

.left-sidebar button {
  margin-bottom: 12px;
  padding: 8px 5px;
  font-size: 12px;
  white-space: nowrap;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #ecf0f1;
  min-height: 50px;
}

.left-sidebar button:hover {
  background-color: #34495e;
}

.left-sidebar button.active {
  background-color: #3498db;
}

.btn-icon {
  font-size: 18px;
  margin-bottom: 4px;
}

.btn-text {
  font-size: 10px;
  white-space: normal;
  max-width: 100%;
  word-break: break-word;
}

/* ========== 中间内容区域 ========== */
.middle-content {
  width: calc(82vw - 30px);
  position: relative;
  min-width: 0;
  display: flex;
  overflow: visible;
  background-color: #fff;
  height: 100vh;
}

.middle-content.drawer-open {
  margin-left: 300px;
  transition: margin-left 0.3s ease;
}

/* ========== 页面主要内容区域 ========== */
.page-content {
  flex: 1;
  /* padding: 20px; */
  overflow-y: auto;
  background-color: #fafafa;
}

.canvas-area {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: #fff;
  border: 1px dashed #ddd;
  border-radius: 4px;
  padding: 20px;
  text-align: center;
  overflow: visible;
  user-select: none;
  width: 100%;
}

/* ========== 图片容器样式 ========== */
.canvas-area > div {
  position: absolute;
  box-sizing: border-box;
}

/* ========== 缩放控制点样式 ========== */
.resize-handle {
  width: 10px;
  height: 10px;
  background-color: #1890ff;
  border: 2px solid white;
  border-radius: 50%;
  z-index: 10;
  cursor: pointer;
  position: absolute;
}

.resize-handle:hover {
  background-color: #40a9ff;
}

.resize-handle.top,
.resize-handle.bottom {
  cursor: ns-resize;
}

.resize-handle.left,
.resize-handle.right {
  cursor: ew-resize;
}

.resize-handle.top-left,
.resize-handle.bottom-right {
  cursor: nwse-resize;
}

.resize-handle.top-right,
.resize-handle.bottom-left {
  cursor: nesw-resize;
}

/* ========== 自定义抽屉样式 ========== */
.custom-drawer {
  position: fixed;
  left: 60px;
  top: 0;
  height: 100%;
  width: 300px;
  background-color: white;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
}

.custom-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px;
  border-bottom: 1px solid #f0f0f0;
}

.drawer-title {
  margin: 0;
  color: #333;
  font-size: 16px;
  font-weight: 500;
}

.drawer-content-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100% - 57px);
}

.drawer-search {
  padding: 16px;
  padding-top: 0;
}

.drawer-search .ant-input-group-addon button {
  background-color: #1890ff;
  color: white;
  border-color: #1890ff;
}

.drawer-items-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 16px;
}

/* ========== 模板图片网格样式 ========== */
.template-grid {
  margin: 0 -8px;
}

.template-col {
  padding: 0 8px;
  margin-bottom: 16px;
}

.template-item {
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s;
  cursor: pointer;
}

.template-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.template-image {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
  background-color: #f5f5f5;
}

.template-info {
  padding: 8px;
}

.template-title {
  font-size: 12px;
  font-weight: 500;
  color: #333;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.template-description {
  font-size: 10px;
  color: #999;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}

.template-meta {
  font-size: 9px;
  color: #ccc;
  display: flex;
  justify-content: space-between;
}

/* ========== 普通抽屉项样式 ========== */
.drawer-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.drawer-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border-radius: 4px;
  transition: background 0.2s;
  cursor: pointer;
}

.drawer-item:hover {
  background-color: #f5f5f5;
}

.item-icon {
  font-size: 16px;
  margin-right: 8px;
  flex-shrink: 0;
}

.item-content {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-size: 13px;
  color: #333;
}

.item-category {
  font-size: 11px;
  color: #999;
}

/* ========== 加载和空状态样式 ========== */
.loading-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.error-message, .empty-message {
  text-align: center;
  padding: 20px;
  color: #999;
  font-size: 14px;
}

.error-message {
  color: #f5222d;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.retry-button {
  margin-top: 10px;
  padding: 4px 12px;
  background-color: #1890ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.retry-button:hover {
  background-color: #40a9ff;
}

/* ========== 抽屉开关按钮 ========== */
.drawer-toggle-btn {
  position: absolute;
  right: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 64px;
  background-color: white;
  border-radius: 0 4px 4px 0;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background 0.2s;
}

.drawer-toggle-btn:hover {
  background-color: #f5f5f5;
}

.custom-drawer.open .arrow-icon {
  transform: rotate(-135deg);
  width: 10px;
  height: 10px;
  border-top: 2px solid #666;
  border-right: 2px solid #666;
  transition: transform 0.3s ease;
}

/* ========== 右侧面板 ========== */
.right-content {
  width: 280px;
  flex-shrink: 0;
  background-color: #f0f0f0;
  padding: 16px;
  overflow-y: auto;
  border-left: 1px solid #d9d9d9;
}

.property-panel h3 {
  margin-top: 0;
  font-size: 14px;
  color: #333;
  padding-bottom: 8px;
  border-bottom: 1px solid #d9d9d9;
}

.property-item {
  margin-bottom: 16px;
}

.property-item label {
  display: block;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

/* ========== 属性面板输入框样式 ========== */
.property-panel input {
  margin-bottom: 8px;
}

/* ========== 尺寸输入框容器 ========== */
.property-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

/* ========== 标签样式 ========== */
.property-item label {
  margin-bottom: 4px;
  font-size: 12px;
  color: #666;
}

/* ========== 输入框组样式 ========== */
.property-input-group {
  display: flex;
  gap: 8px;
}

/* ========== 可编辑输入框样式 ========== */
.property-panel input[type="text"]:not([readonly]) {
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

/* ========== 响应式适配 ========== */
@media (max-width: 992px) {
  .right-content {
    width: 240px;
  }
}

@media (max-width: 768px) {
  .right-content {
    display: none;
  }
  
  .custom-drawer {
    width: 80vw;
    left: 60px;
  }
  
  .middle-content.drawer-open {
    margin-left: calc(60px + 80vw);
  }
  
  .template-col {
    span: 24;
  }
}

@media (max-width: 480px) {
  .left-sidebar {
    width: 50px;
  }
  
  .custom-drawer {
    width: 85vw;
    left: 50px;
  }
  
  .middle-content.drawer-open {
    margin-left: calc(50px + 85vw);
  }
}